import {EditableProTable} from "@ant-design/pro-table";
import {GenerateColumnVO} from "@/services/GenerateColumnService";
import {ProColumns, ProTable} from "@ant-design/pro-components";
import {ReactNode, useState} from "react";
import {Switch} from "antd";
import {UseFetchDataAction} from "@ant-design/pro-table/es/typing";

interface GenerateColumnTableProps {
  onColumnsChange: (columns: GenerateColumnVO[]) => void;
  businessId?: string;
  columns?: GenerateColumnVO[]
}

const GenerateColumnTable = (props: GenerateColumnTableProps) => {
  const columns: ProColumns<GenerateColumnVO>[] = [
    {
      title: "id",
      dataIndex: "id",
      hideInSearch: true,
      hideInTable: true,
    },
    {
      title: "业务id",
      dataIndex: "businessId",
      hideInSearch: true,
      hideInTable: true,
    },
    {
      title: "列名",
      dataIndex: "columnName",
      hideInSearch: true,
      readonly: true,
    },
    {
      title: "排序",
      dataIndex: "orderPosition",
      hideInSearch: true,
      readonly: true,
    },
    {
      title: "列默认值",
      dataIndex: "columnDefault",
      hideInSearch: true,
      readonly: true,
    },
    {
      title: "是否为可空",
      dataIndex: "isNullable",
      hideInSearch: true,
    },
    {
      title: "列数据类型",
      dataIndex: "dataType",
      hideInSearch: true,
      readonly: true,
    },
    {
      title: "key",
      dataIndex: "columnKey",
      hideInSearch: true,
    },
    {
      title: "列注释",
      dataIndex: "columnComment",
      hideInSearch: true,
    },
    {
      title: "是否展示",
      dataIndex: "isShow",
      hideInSearch: true,

    },
    {
      title: "是否可编辑",
      dataIndex: "isEdit",
      hideInSearch: true,
    },
    {
      title: "是否可查询",
      dataIndex: "isQuery",
      hideInSearch: true
    }
  ]

  return <>
    <ProTable
      columns={columns}
      dataSource={props.columns}
    />
  </>
}

export default GenerateColumnTable
